unit Pantalla;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Menus, StdCtrls, ExtCtrls,ShellAPI;

type
  TForm1 = class(TForm)
    MainMenu1: TMainMenu;
    Ver1: TMenuItem;
    Abrir1: TMenuItem;
    PascalYacc1: TMenuItem;
    Ayuda1: TMenuItem;
    Documentacin1: TMenuItem;
    Acercade1: TMenuItem;
    Salir1: TMenuItem;
    Memo2: TMemo;
    Memo3: TMemo;
    Button1: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Button2: TButton;
    Button3: TButton;
    Image1: TImage;
    Memo1: TMemo;
    Button4: TButton;
    OpenDialog1: TOpenDialog;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Abrir1Click(Sender: TObject);
    procedure PascalYacc1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
    procedure Salir1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }

  end;

var
  Form1: TForm1;
  str : string;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin

//if OpenDialog1.Execute = true then
//begin
//  str := ExtractFileName(OpenDialog1.filename);
//  Memo1.Lines.LoadFromFile(str);
//  Memo1.Lines.SaveToFile('C:\Compilator\Version_Final\Codigos_Fuentes\codigo.pas');
Memo1.Lines.LoadFromFile('C:\Compilator\Version_Final\Codigos_Fuentes\codigo.pas');
button2.Enabled:= true;
button4.Enabled:= true;

//end;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
Memo1.Lines.SaveToFile('C:\Compilator\Version_Final\Codigos_Fuentes\codigo.pas');
//Memo1.Lines.SaveToFile(str);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
memo3.Clear;
ShellExecute(handle, 'open', ('C:\Compilator\Version_Final\Pascal_Yacc.py.lnk'), nil, nil, SW_SHOWNORMAL);
Memo3.Lines.LoadFromFile('C:\Compilator\Version_Final\Resultados\log_errores.txt');
button3.Enabled:= true;
button5.Enabled:= true;
button7.Enabled:= true;
end;

procedure TForm1.Abrir1Click(Sender: TObject);
begin
form2.Label1.Caption:= 'Pascal-Lex';
form2.Memo1.Lines.LoadFromFile('C:\Compilator\Version_Final\Pascal_Lex.py');
form2.showmodal;

end;

procedure TForm1.PascalYacc1Click(Sender: TObject);
begin
form2.Label1.Caption := 'Pascal-Yacc';
form2.Memo1.Lines.LoadFromFile('C:\Compilator\Version_Final\Pascal_Yacc.py');
form2.showmodal;

end;

procedure TForm1.Button3Click(Sender: TObject);
begin
ShellExecute(handle, 'open', ('C:\Compilator\Version_Final\Resultados\Codigo_intermedio.xhtml'), nil, nil, SW_SHOWNORMAL);
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
Memo3.Lines.LoadFromFile('C:\Compilator\Version_Final\Resultados\log_errores.txt');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
memo1.Clear;
memo1.Text:= 'Fuente';
memo2.Clear;
memo3.Clear;

end;

procedure TForm1.Button6Click(Sender: TObject);
begin

Memo2.Lines.LoadFromFile('C:\Compilator\Version_Final\Resultados\Codigo_Final.pas');
end;

procedure TForm1.Button7Click(Sender: TObject);
begin
ShellExecute(handle, 'open', ('C:\Compilator\Version_Final\Pascal_Delphi.py.lnk'), nil, nil, SW_SHOWNORMAL);
button6.Enabled:= true;
end;

procedure TForm1.Salir1Click(Sender: TObject);
begin
  form1.close;
end;

end.
